//
//  AppDelegate.m
//  MyDemo
//
//  Created by yuanjiang on 2018/1/29.
//  Copyright © 2018年 yuanjiang. All rights reserved.
//

#import "AppDelegate.h"
#import <RongIMKit/RongIMKit.h>

#define kSDKKey @"k51hidwqknkqb"
#define kSDKSecert @"k51hidwqknkqb"
// 申
#define kToken1 @"IUrYhmZBdlB0LtqeNgxdr5ZlA6KpGYVe4LH/cHsMew2edHXQD1Kckm1sHgwJWmcaDaX7i2TjaJB9VLYIh+CDbg=="
// 胡
#define kToken2 @"j0FHKYLJUm1glrldWlodHpZlA6KpGYVe4LH/cHsMew2edHXQD1KcksziJ3BG+/5BHqksXgaS5KUOJQrbgWO8mA=="
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //初始化sdk
    [[RCIM  sharedRCIM] initWithAppKey:kSDKKey];
    //连接服务器
    [[RCIM sharedRCIM] connectWithToken:kToken1 success:^(NSString *userId) {
        NSLog(@"登陆成功。当前登录的用户ID：%@", userId);
        [[NSUserDefaults standardUserDefaults]setObject:userId forKey:@"userId"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    } error:^(RCConnectErrorCode status) {
        NSLog(@"登陆的错误码为:%ld", (long)status);
    } tokenIncorrect:^{
        //token过期或者不正确。
        //如果设置了token有效期并且token过期，请重新请求您的服务器获取新的token
        //如果没有设置token有效期却提示token错误，请检查您客户端和服务器的appkey是否匹配，还有检查您获取token的流程。
        NSLog(@"token错误");
    }];
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {

}


- (void)applicationDidEnterBackground:(UIApplication *)application {

}


- (void)applicationWillEnterForeground:(UIApplication *)application {

}


- (void)applicationDidBecomeActive:(UIApplication *)application {

}


- (void)applicationWillTerminate:(UIApplication *)application {

}


@end
